﻿using System;
using System.Collections.Generic;
using System.Web.Script.Serialization;
using WeiXinSDK.DataModel.Enum;

namespace WeiXinSDK.DataModel
{
    /// <summary>
    /// 群发消息
    /// </summary>
    public class SendMessage
    {

        private MessageType _MessageType = MessageType.Mpnews;

        /// <summary>
        /// 群发的消息类型，图文消息为mpnews，文本消息为text，语音为voice，音乐为music，图片为image，视频为video ，
        /// 无需提交到微信
        /// </summary>
        [ScriptIgnore]
        public MessageType MessageType
        {
            get { return _MessageType; }
            set
            {
                _MessageType = value;
                msgtype = this.MessageType.ToString().ToLower();
            }
        }

        /// <summary>
        /// 群发的消息类型，图文消息为mpnews，文本消息为text，语音为voice，音乐为music，图片为image，视频为video 
        /// </summary>
        public string msgtype { get; set; }

        /// <summary>
        /// 根据分组进行群发
        /// </summary>
        public Filter filter { get; set; }

        /// <summary>
        ///  根据OpenID列表群发 
        /// </summary>
        public List<string> touser { get; set; }

        /// <summary>
        /// 图文消息
        /// </summary>
        public Mpnews mpnews { get; set; }

        /// <summary>
        /// 文本
        /// </summary>
        public Text text { get; set; }

        /// <summary>
        /// 语音
        /// </summary>
        public Voice voice { get; set; }

        /// <summary>
        /// 视频
        /// </summary>
        public Video video { get; set; }
    }

    /// <summary>
    /// 分组ID
    /// </summary>
    public class Filter
    {
        public string group_id { get; set; }
    }

    /// <summary>
    /// 图文消息
    /// </summary>
    public class Mpnews
    {
        public string media_id { get; set; }
    }

    /// <summary>
    /// 文本消息
    /// </summary>
    public class Text
    {
        public string content { get; set; }
    }

    /// <summary>
    /// 语音
    /// </summary>
    public class Voice
    {
        public string media_id { get; set; }
    }

    /// <summary>
    /// 图片
    /// </summary>
    public class Image
    {
        public string media_id { get; set; }
    }
}
